package com.imooc.dianping.dal;

import com.imooc.dianping.model.ShopModel;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ShopModelMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(ShopModel record);

    int insertSelective(ShopModel record);

    ShopModel selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ShopModel record);

    int updateByPrimaryKey(ShopModel record);

    List<ShopModel> selectAll();

    Integer countAllShop();

    List<ShopModel> recommend(@Param("latitude") BigDecimal latitude, @Param("longitude") BigDecimal longitude);

    List<ShopModel> search(@Param("latitude") BigDecimal latitude, @Param("longitude") BigDecimal longitude,
                           @Param("keyword") String keyword, @Param("orderby") Integer orderby,
                           @Param("categoryId") Integer categoryId, @Param("tags") String tags);

    List<Map<String, Object>> searchGroupByTags(@Param("keyword") String keyword,
                                                @Param("categoryId") Integer categoryId,
                                                @Param("tags") String tags);

    //当着3个参数中任意一个参数发生变化，我只需要将发生变化的ID传入，重建与此ID关联的索引
    List<Map<String,Object>> buildESQuery(@Param("sellerId")Integer sellerId,@Param("categoryId")Integer categoryId,
                                          @Param("shopId")Integer shopId);

}
